--跃浪之行
local yuelangzhixing = fk.CreateSkill{
  name = "mcdh_yuelangzhixing",
}

yuelangzhixing:addEffect('active', {
  prompt = "#mcdh_YueLangZhiXing",
  anim_type = "drawcard",
  can_use = function(self, player)
    return player:getMark("ncs_YueLangZhiXing_m-turn") ~= 1
  end,
  target_num = 0,
  card_num = 0,
  card_filter = Util.FalseFunc,
  target_filter = Util.FalseFunc,
  on_use = function(self, room, effect)
    local player = room:getPlayerById(effect.from)
    player:drawCards(player.maxHp - player:getHandcardNum(),self.name)
    player.room:setPlayerMark(player,"ncs_YueLangZhiXing_d",1)
    player.room:setPlayerMark(player,"ncs_YueLangZhiXing_m-turn",1)
  end,
})

yuelangzhixing:addEffect(fk.AskForCardUse,{
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    local all_names = U.getAllCardNames("b",false)
    return player:hasSkill(self) and target == player and player:getMark("ncs_YueLangZhiXing_m-turn") ~= 1 and (data.pattern and Exppattern:Parse(data.pattern):matchExp("slash,jink|.|.|.|.|."))
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(player.maxHp - player:getHandcardNum(),self.name)
    player.room:setPlayerMark(player,"ncs_YueLangZhiXing_d",1)
    player.room:setPlayerMark(player,"ncs_YueLangZhiXing_m-turn",1)
  end,
})

yuelangzhixing:addEffect(fk.AskForCardResponse,{
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    local all_names = U.getAllCardNames("b",false)
    return player:hasSkill(self) and target == player and player:getMark("ncs_YueLangZhiXing_m-turn") ~= 1 and (data.pattern and Exppattern:Parse(data.pattern):matchExp("slash,jink|.|.|.|.|."))
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(player.maxHp - player:getHandcardNum(),self.name)
    player.room:setPlayerMark(player,"ncs_YueLangZhiXing_d",1)
    player.room:setPlayerMark(player,"ncs_YueLangZhiXing_m-turn",1)
  end,
})

yuelangzhixing:addEffect(fk.CardUseFinished,{
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and player:getMark("ncs_YueLangZhiXing_d") == 1
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player,"ncs_YueLangZhiXing_d",0)
    local n = player:getHandcardNum()
    room:askForDiscard(player,n-1,n-1,false,self.name,false,".","#mcdh_ylzx_discard")
  end,
})

yuelangzhixing:addEffect(fk.CardRespondFinished,{
  can_trigger = function(self, event, target, player, data)
    return target == player and player:getMark("ncs_YueLangZhiXing_d") == 1
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player,"ncs_YueLangZhiXing_d",0)
    local n = player:getHandcardNum()
    room:askForDiscard(player,n-1,n-1,false,self.name,false,".","#mcdh_ylzx_discard")
  end,
})

return yuelangzhixing
